<div class="card-block">
  <div class="progress-static top">
    <div class="progress-meter" [attr.data-value]="progress"></div>
  </div>
  <div class="card-title">{{ auto.name }}</div>
  <div class="card-text" *ngIf="auto.description !== ''">
    {{ auto.description }}
  </div>
  <form clrForm clrLayout="compact">
    <clr-checkbox-container>
      <label>激活</label>
      <clr-checkbox-wrapper>
        <label>开启</label>
        <input
          clrCheckbox
          type="checkbox"
          [(ngModel)]="auto.on"
          name="on"
          (change)="onActivationChange()"
        />
      </clr-checkbox-wrapper>
      <clr-checkbox-wrapper *ngIf="auto.stopWhenFactoryUi">
        <label>如果没有机器人工厂</label>
        <input
          clrCheckbox
          type="checkbox"
          [(ngModel)]="auto.stopWhenFactory"
          name="stopFactory"
        />
      </clr-checkbox-wrapper>
    </clr-checkbox-container>

    <clr-select-container>
      <label>时间间隔</label>
      <select clrSelect name="interval" [(ngModel)]="auto.minInterval">
        <option
          *ngFor="let time of intervals; trackBy: timeId"
          [value]="time"
          >{{ time }}</option
        >
      </select>
    </clr-select-container>

    <clr-input-container>
      <label>优先级</label>
      <input
        clrInput
        type="number"
        [(ngModel)]="auto.priority"
        name="priority"
      />
    </clr-input-container>

    <clr-input-container *ngIf="auto.showResourceUsage">
      <label class="clr-col-12 clr-col-md-3"
        >资源
        <app-formatted-quantity
          [quantity]="auto.resourcePercentToUse"
          [integer]="true"
        ></app-formatted-quantity
        >%
      </label>
      <input
        class="clr-col-12 clr-col-md-9"
        clrInput
        max="100"
        min="1"
        step="1"
        type="range"
        name="resToUse"
        [(ngModel)]="auto.resourcePercentToUse"
    /></clr-input-container>

    <app-search-automator
      *ngIf="auto === ms.game.automatorManager.searchAutomator"
    ></app-search-automator>
  </form>
</div>
